package org.appfuse.model;

import java.sql.Date;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.CompareToBuilder;

/**
 * @struts.form include-all="true" extends="org.appfuse.webapp.form.BaseForm"
 * @hibernate.class table="dutylevel"
 */

public class Dutylevel extends org.appfuse.model.BaseObject implements
		java.io.Serializable, Comparable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 2194557508583042363L;

	private Integer id;

	private BasicInfo basicInfo;

	private String zj;

	private Date pzrq;

	private Date zzrq;

	private String a00;

	private String zjzt;

	private String pzjgmc;

	private String pzjgmcbc;

	private String zjpzwh;

	private String zjpzsszdwmc;

	private String zjpzssrzw;

	// Constructors

	public String getA00() {
		return a00;
	}

	public void setA00(String a00) {
		this.a00 = a00;
	}

	public String getPzjgmc() {
		return pzjgmc;
	}

	public void setPzjgmc(String pzjgmc) {
		this.pzjgmc = pzjgmc;
	}

	public String getPzjgmcbc() {
		return pzjgmcbc;
	}

	public void setPzjgmcbc(String pzjgmcbc) {
		this.pzjgmcbc = pzjgmcbc;
	}

	public String getZjpzssrzw() {
		return zjpzssrzw;
	}

	public void setZjpzssrzw(String zjpzssrzw) {
		this.zjpzssrzw = zjpzssrzw;
	}

	public String getZjpzsszdwmc() {
		return zjpzsszdwmc;
	}

	public void setZjpzsszdwmc(String zjpzsszdwmc) {
		this.zjpzsszdwmc = zjpzsszdwmc;
	}

	public String getZjpzwh() {
		return zjpzwh;
	}

	public void setZjpzwh(String zjpzwh) {
		this.zjpzwh = zjpzwh;
	}

	public String getZjzt() {
		return zjzt;
	}

	public void setZjzt(String zjzt) {
		this.zjzt = zjzt;
	}

	/** default constructor */
	public Dutylevel() {
	}

	/** full constructor */
	public Dutylevel(String zj, Date pzrq, Date zzrq) {
		this.zj = zj;
		this.pzrq = pzrq;
		this.zzrq = zzrq;
	}

	// Property accessors

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public BasicInfo getBasicInfo() {
		return basicInfo;
	}

	public void setBasicInfo(BasicInfo basicInfo) {
		this.basicInfo = basicInfo;
	}

	public String getZj() {
		return this.zj;
	}

	public void setZj(String zj) {
		this.zj = zj;
	}

	public Date getPzrq() {
		return this.pzrq;
	}

	public void setPzrq(Date pzrq) {
		this.pzrq = pzrq;
	}

	public Date getZzrq() {
		return this.zzrq;
	}

	public void setZzrq(Date zzrq) {
		this.zzrq = zzrq;
	}

	@Override
	public int hashCode() {
		final int PRIME = 31;
		int result = 1;
		result = PRIME * result + ((a00 == null) ? 0 : a00.hashCode());
		result = PRIME * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final Dutylevel other = (Dutylevel) obj;
		if (a00 == null) {
			if (other.a00 != null)
				return false;
		} else if (!a00.equals(other.a00))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * @see java.lang.Comparable#compareTo(Object)
	 */
	public int compareTo(Object object) {
		Dutylevel myClass = (Dutylevel) object;
		int theZjzt = 0;
		
		if (this.zjzt.compareTo("0") > 0){
			theZjzt = 1;
		}else{
			theZjzt = 0;
		}
		
		int otherZjzt = 0;
		if (object != null){
			
			if (!StringUtils.isEmpty(myClass.getZjzt())){
				if (myClass.getZjzt().compareTo("0") > 0){
					otherZjzt = 1;
				}else{
					otherZjzt = 0;
				}
			}
		}
		int ret = theZjzt - otherZjzt;
		if (ret != 0){
			return ret;
		}else{
			return myClass.getZj().compareToIgnoreCase(zj);
		}
	}

}